package com.example.alarmasvecinales;

import android.app.Activity;
import android.content.Context;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;

import android.widget.Toast;

public class coordenadasGps extends Activity {
	
	private LocationManager locManager;
	private LocationListener locListener;
	
		public double obtenerlatitud(){
		 locManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
	    Location loc = locManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);

         Toast.makeText(this, "Latitud:"+ loc.getLatitude(), Toast.LENGTH_SHORT).show();
		return loc.getLatitude();
			
		}
		
	
		public double obtenerlongitud(){
			locManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
		    Location loc = locManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
		    Toast.makeText(this, "Longitud:"+ loc.getLongitude(), Toast.LENGTH_SHORT).show();
			return  loc.getLongitude();
			
		}
}
